<template>
	<view class="release-page">
		<NavBar title="待出库订单"/>
		<view class="order-list" v-if="list.length">
			<view class="item" v-for="order in list" :key="order?.order_sn">
				<view class="order-info"> 创建时间：{{ order.pay_time }} </view>
				<view class="order-info"> 订单号：{{ order.order_sn }} </view>
				<view class="action">
					<wd-button size="small" @click="nav('/pages/mine/releaseDetail?order_sn='+order.order_sn)"> 查看详情 </wd-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
	import NavBar from '@/components/NavBar.vue'
	import { outHouseListApi } from '@/api'
	const list = ref([])
	const getOutList = () => {
		outHouseListApi().then(res => {
			list.value = res
			uni.stopPullDownRefresh()
		})
	}
	const nav = (url) => {
		uni.navigateTo({ url })
	}
	onShow(() => {
		getOutList()
	})
	onPullDownRefresh(() => {
		getOutList()
	})
</script>

<style lang="scss" scoped>
	.order-list {
		gap: 20rpx;
		display: flex;
		flex-direction: column;
		padding: 20rpx 24rpx;
		.item {
			padding: 20rpx;
			border-radius: 10px;
			background-color: #fff;
			.order-info {
				padding: 20rpx 0;
			}
			.action {
				display: flex;
				justify-content: end;
				padding-top: 20rpx;
				border-top: 1px solid #eee;
			}
		}
	}
</style>
